package com.example.demoserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demoserver.entity.InteAppalarm;
import com.example.demoserver.entity.InteLog;
import com.example.demoserver.service.InteAppalarmService;
import com.example.demoserver.mapper.InteAppalarmMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 18364
* @description 针对表【inte_appalarm】的数据库操作Service实现
* @createDate 2024-02-28 17:21:30
*/
@Service
public class InteAppalarmServiceImpl extends ServiceImpl<InteAppalarmMapper, InteAppalarm>
    implements InteAppalarmService{
    @Autowired
    InteAppalarmMapper inteAppalarmMapper;
    @Override
    public List<InteAppalarm> selectAll() {
        QueryWrapper<InteAppalarm> queryWrapper=new QueryWrapper<>();
        queryWrapper.orderByDesc("alarmTime");
        List<InteAppalarm> list=inteAppalarmMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public List<InteAppalarm> selectByType(Integer type) {
        QueryWrapper<InteAppalarm> queryWrapper=new QueryWrapper<>();
        queryWrapper.orderByDesc("alarmTime");
        if(type!=null){

            queryWrapper.eq("alarmType",type);
            return inteAppalarmMapper.selectList(queryWrapper);
        }
        return inteAppalarmMapper.selectList(null);
    }
}




